//
//  HUDManager.m
//  OWEnglish
//
//  Created by yule on 16/7/13.
//  Copyright © 2016年 gearedu. All rights reserved.
//

#import "MujiHUDManager.h"

@interface MujiHUDManager()

@property (nonatomic, strong) MBProgressHUD   *hud;




@end


@implementation MujiHUDManager

+ (instancetype)shareManager
{
    static MujiHUDManager *manager;
    static  dispatch_once_t token;

    dispatch_once(&token, ^{
        manager = [[MujiHUDManager alloc] init];
    });
    
    return manager;
}

- (instancetype)init
{
    if (self = [super init]) {
     
        //UIView *window = [UIApplication sharedApplication].keyWindow;
        
        //self.hud = [MBProgressHUD showHUDAddedTo:window animated:YES];
//        self.hud.mode = MBProgressHUDModeText;
//        self.hud.animationType = MBProgressHUDAnimationZoomOut;
//        self.hud.labelText = NSLocalizedString(@"获取数据失败，请检查网络连接!", @"HUD message title");
//        [self.hud hide:YES afterDelay:1.2f];
        
    }
    return self;
}


- (void)showHUDWithTitle:(NSString *)title mode:(MBProgressHUDMode)mode delay:(NSTimeInterval)delay
{
    UIView *window = [UIApplication sharedApplication].keyWindow;

    self.hud = [MBProgressHUD showHUDAddedTo:window animated:YES];
    self.hud.mode = mode;
    //self.hud.animationType = MBProgressHUDAnimationZoomOut;
    self.hud.label.text = title;
    [self.hud hideAnimated:YES afterDelay:delay];

}

- (void)showHUDWithTitle:(NSString *)title mode:(MBProgressHUDMode)mode
{
    UIView *window = [UIApplication sharedApplication].keyWindow;
    
    self.hud = [MBProgressHUD showHUDAddedTo:window animated:YES];
    self.hud.mode = mode;
    //self.hud.animationType = MBProgressHUDAnimationZoomOut;
    self.hud.label.text = title;

    
}
- (void)hideHud
{
    [self.hud hideAnimated:YES];
}


@end
